/**
 * created by dqn 2018/3/7
 */

package main.util;

import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class MD5Util {
    public String getEncodedMD5(String value) {
        try {
            MessageDigest md5 = MessageDigest.getInstance("MD5");
            md5.update(value.getBytes());
            md5.update("salt".getBytes());
            byte[] md5Array = md5.digest();
            BigInteger bigInteger = new BigInteger(1, md5Array);
            String result = bigInteger.toString(16);
            return result;
        } catch (NoSuchAlgorithmException e) {
            e.printStackTrace();
            return null;
        }
    }
}
